
package org.bridgen.lang.semantics.ast;
import java.util.*;


public class PatternUse extends Use implements Cloneable {
    public void flushCache() {
        super.flushCache();
    }
     @SuppressWarnings({"unchecked", "cast"})  public PatternUse clone() throws CloneNotSupportedException {
        PatternUse node = (PatternUse)super.clone();
        node.in$Circle(false);
        node.is$Final(false);
    return node;
    }
     @SuppressWarnings({"unchecked", "cast"})  public PatternUse copy() {
      try {
          PatternUse node = (PatternUse)clone();
          if(children != null) node.children = (ASTNode[])children.clone();
          return node;
      } catch (CloneNotSupportedException e) {
      }
      System.err.println("Error: Could not clone node of type " + getClass().getName() + "!");
      return null;
    }
     @SuppressWarnings({"unchecked", "cast"})  public PatternUse fullCopy() {
        PatternUse res = (PatternUse)copy();
        for(int i = 0; i < getNumChildNoTransform(); i++) {
          ASTNode node = getChildNoTransform(i);
          if(node != null) node = node.fullCopy();
          res.setChild(node, i);
        }
        return res;
    }
    // Declared in PrettyPrint.jrag at line 267

    
    public void pp(StringBuffer buf) {
     	buf.append(getName());
    }

    // Declared in TypeCodeGen.jrag at line 523

	
	public void generateCode(String indent, StringBuffer buf) {
		buf.append(getName());
	}

    // Declared in bridgit.ast at line 3
    // Declared in bridgit.ast line 112

    public PatternUse() {
        super();


    }

    // Declared in bridgit.ast at line 10


    // Declared in bridgit.ast line 112
    public PatternUse(String p0) {
        setName(p0);
    }

    // Declared in bridgit.ast at line 14


  protected int numChildren() {
    return 0;
  }

    // Declared in bridgit.ast at line 17

  public boolean mayHaveRewrite() { return false; }

    // Declared in bridgit.ast at line 2
    // Declared in bridgit.ast line 112
    protected String tokenString_Name;

    // Declared in bridgit.ast at line 3

    public void setName(String value) {
        tokenString_Name = value;
    }

    // Declared in bridgit.ast at line 6

    public String getName() {
        return tokenString_Name != null ? tokenString_Name : "";
    }

    // Declared in NameAnalysis.jrag at line 171
 @SuppressWarnings({"unchecked", "cast"})     public AttrDecl lookupAttrDecl(String name) {
        AttrDecl lookupAttrDecl_String_value = lookupAttrDecl_compute(name);
        return lookupAttrDecl_String_value;
    }

    private AttrDecl lookupAttrDecl_compute(String name) {
		NodeUse nodeUse = decl();
		if (nodeUse == null) {
			return null;
		}
		NodeDecl nodeDecl = nodeUse.decl();
		if (nodeDecl == null) {
			return null;
		}
		return nodeDecl.lookupAttrDecl(name);
	}

    // Declared in NameAnalysis.jrag at line 186
 @SuppressWarnings({"unchecked", "cast"})     public boolean isPatternUse() {
        boolean isPatternUse_value = isPatternUse_compute();
        return isPatternUse_value;
    }

    private boolean isPatternUse_compute() {  return true;  }

    // Declared in NameAnalysis.jrag at line 188
 @SuppressWarnings({"unchecked", "cast"})     public NodeUse decl() {
        NodeUse decl_value = decl_compute();
        return decl_value;
    }

    private NodeUse decl_compute() {  return lookupVariable(getName());  }

    // Declared in TypeAnalysis.jrag at line 71
 @SuppressWarnings({"unchecked", "cast"})     public String type() {
        String type_value = type_compute();
        return type_value;
    }

    private String type_compute() {  return decl() != null ? decl().getName() : super.type();  }

    // Declared in TypeCodeGen.jrag at line 552
 @SuppressWarnings({"unchecked", "cast"})     public String callString() {
        String callString_value = callString_compute();
        return callString_value;
    }

    private String callString_compute() {  return getName();  }

    // Declared in NameAnalysis.jrag at line 189
 @SuppressWarnings({"unchecked", "cast"})     public NodeUse lookupVariable(String name) {
        NodeUse lookupVariable_String_value = getParent().Define_NodeUse_lookupVariable(this, null, name);
        return lookupVariable_String_value;
    }

public ASTNode rewriteTo() {
    return super.rewriteTo();
}

}
